static-delta: do not accept both --from=REV and --empty for generate
authorGiuseppe Scrivano <gscrivan@redhat.com>
Wed, 14 Jan 2015 15:53:21 +0000 (16:53 +0100)
committerColin Walters <walters@verbum.org>
Fri, 16 Jan 2015 03:54:56 +0000 (22:54 -0500)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
src/ostree/ot-builtin-static-delta.c
tests/test-delta.sh

index 45ba6b67e425a1a739f7d47974855c378b6a81ae..b49b9182b9f38d8443007151d80d8d9eededb47a 100644 (file)
@@ -157,6 +157,12 @@ ot_static_delta_builtin_generate (int argc, char **argv, GCancellable *cancellab
 
       if (opt_empty)
         {
+          if (opt_from_rev)
+            {
+              g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                                   "Cannot specify both --empty and --from=REV");
+              goto out;
+            }
           from_source = NULL;
         }
       else if (opt_from_rev == NULL)
index c598186126f53183e6ca2b6c396ca7a3cf408ebe..6420b21f93862d7ae579ff049772f4a7acb0d537 100755 (executable)
@@ -68,6 +68,10 @@ ostree --repo=repo static-delta generate --from=${origrev} --to=${newrev}
 
 ostree --repo=repo static-delta list | grep ${origrev}-${newrev} || exit 1
 
+if ${CMD_PREFIX} ostree --repo=repo static-delta generate --from=${origrev} --to=${newrev} --empty 2>>err.txt; then
+    assert_not_reached "static-delta generate --from=${origrev} --empty unexpectedly succeeded"
+fi
+
 origstart=$(echo ${origrev} | dd bs=1 count=2 2>/dev/null)
 origend=$(echo ${origrev} | dd bs=1 skip=2 2>/dev/null)
 assert_has_dir repo/deltas/${origstart}/${origend}-${newrev}